package com.mc.read.pcApi.controller;

import com.mc.read.pcApi.service.UserService;
import com.mc.read.vo.request.BaseRequest;
import com.mc.read.vo.respose.BaseRespose;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author:LiuHao
 * @Date:14:30 2019/5/30
 * 用户信息
 **/
@Controller
@RequestMapping(value = "/verify/user/")
@Slf4j
public class UserController {
    @Autowired
    UserService userService;

    /**
     * @Author:LiuHao
     * @Date:18:24 2019/5/30
     * 用户个人信息展示 selectUserInfo
     **/
    @ResponseBody
    @RequestMapping(value = "selectUserInfo", method = RequestMethod.POST)
    public BaseRespose selectUserInfo(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectUserInfo(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:01 2019/5/31
     * 修改用户个人信息 updateUserInfodet
     **/
    @ResponseBody
    @RequestMapping(value = "updateUserInfodet", method = RequestMethod.POST)
    public BaseRespose updateUserInfodet(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updateUserInfodet(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:14:57 2019/5/31
     * 查询用户账号信息 selectUserAccount
     **/
    @ResponseBody
    @RequestMapping(value = "selectUserAccount", method = RequestMethod.POST)
    public BaseRespose selectUserAccount(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectUserAccount(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:00 2019/5/31
     * 修改用户微信号 updateUserWx
     **/
    @ResponseBody
    @RequestMapping(value = "updateUserWx", method = RequestMethod.POST)
    public BaseRespose updateUserWx(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updateUserWx(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户更换手机号 发送验证码 sendSmsForUpdate
     **/
    @ResponseBody
    @RequestMapping(value = "sendSmsForUpdate", method = RequestMethod.POST)
    public BaseRespose sendSmsForUpdate(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.sendSmsForUpdate(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户更换手机 验证旧手机验证码 valOldPhone
     **/
    @ResponseBody
    @RequestMapping(value = "valOldPhone", method = RequestMethod.POST)
    public BaseRespose userService(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.valOldPhone(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户更换手机 确认更换 updateUserPhone
     **/
    @ResponseBody
    @RequestMapping(value = "updateUserPhone", method = RequestMethod.POST)
    public BaseRespose updateUserPhone(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updateUserPhone(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户查询意见反馈列表 selectUserOpinionList
     **/
    @ResponseBody
    @RequestMapping(value = "selectUserOpinionList", method = RequestMethod.POST)
    public BaseRespose selectUserOpinionList(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.selectUserOpinionList(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户 提交意见反馈 addUserOpinion
     **/
    @ResponseBody
    @RequestMapping(value = "addUserOpinion", method = RequestMethod.POST)
    public BaseRespose addUserOpinion(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.addUserOpinion(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户 标记已处理的意见反馈 updateOpinionState
     **/
    @ResponseBody
    @RequestMapping(value = "updateOpinionState", method = RequestMethod.POST)
    public BaseRespose updateOpinionState(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = userService.updateOpinionState(baseRequest);
        return baseRespose;
    }
}
